//
//  LiveWebVIew.m
//  UIA段项目 墨家天气
//
//  Created by dllo on 15/9/4.
//  Copyright (c) 2015年 dllo. All rights reserved.
//

#import "LiveWebVIew.h"

@interface LiveWebVIew ()<UIWebViewDelegate>
@property (nonatomic,retain)UIWebView *webView;
@property (nonatomic,retain)UIView *headerView;
@end

@implementation LiveWebVIew
-(void)dealloc
{
    
    [_webView release];
    [_headerView release];
    [_urlStr release];
    [super dealloc];
    
}
- (void)viewDidLoad {
    [super viewDidLoad];
    self.view.backgroundColor = [UIColor whiteColor];
    [self addWebView];
    [self addHeaderView];
    // Do any additional setup after loading the view.
}

- (void)addWebView
{

    self.webView = [[UIWebView alloc] initWithFrame:CGRectMake(0, 60 * OffHeight, self.view.frame.size.width, self.view.frame.size.height - 60 * OffHeight)];
    NSURLRequest *request = [[NSURLRequest alloc] initWithURL:[NSURL URLWithString:self.urlStr]];
    self.webView.delegate = self;
    [self.webView loadRequest:request];
    
    [self.view addSubview:self.webView];
    [request release];
    [_webView release];
}
- (void)addHeaderView
{
    
    self.headerView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, 60 * OffHeight)];
    _headerView.backgroundColor = [UIColor blackColor];
    _headerView.alpha = 0.5;
    [self.view addSubview:_headerView];
    [_headerView release];
    
    UIButton *button = [UIButton buttonWithType:UIButtonTypeSystem];
    button.frame = CGRectMake(0, 25 * OffHeight, 50 * OffWidth, 30 * OffHeight);
    [button setTitle:@"返回" forState:UIControlStateNormal];
    [button setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    [button addTarget:self action:@selector(back:) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:button];
    
    
}

- (void)back:(UIButton *)button
{
    [self dismissViewControllerAnimated:YES completion:nil];
    
}

       
    
    

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
